import java.util.Scanner;

public class GuessNum {
    static public void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        int inputNum = 0, count = 0;
        long phone = 0;
        char ch;
        int randNum = (int)(Math.random() * 100);

        while (count < 10) {
            System.out.printf("请猜数字(0 - 100, -1为退出): ");
            inputNum = sc.nextInt();

            if (inputNum == -1) {
                break;
            }
            if (inputNum == randNum) {
                while (true) {
                    System.out.printf("恭喜你, 猜对了,"
                                       + " 请留下联系电话以便领取奖品!\n");
                    System.out.printf("联系方式: ");
                    phone = sc.nextLong();
                    if (phone != 0) {
                        break;
                    }
                }
                break;
            } else if (inputNum > randNum) {
                ch = '大';
            } else {
                ch = '小';
            }
            System.out.printf("稍微%c了一点点..., "
                                + "还有 \033[31m%d\033[0m 次机会!\n",
                                    ch,  10 - ++count);
        }
    }
}
